package com.chandra.pos.payment.dao.entity;


import com.chandra.pos.common.dao.AbstractAuditableEntity;
import com.chandra.pos.common.model.POSConstant;
import com.chandra.pos.common.utils.JodaDateTimeJsonSerializer;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hibernate.annotations.Type;
import org.joda.time.DateTime;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;

/**
 * Created by Admin on 8/14/14.
 */
@Entity
@Table(name = "POS_PAYMENTS")
public class PaymentEntity extends AbstractAuditableEntity {


    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "PAYMENT_ID", unique = true, nullable = false)
    protected Long paymentId;

    @Column(name = "PAYMENT_DATE", unique = false, nullable = true)
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
    @JsonSerialize(using = JodaDateTimeJsonSerializer.class)
    @DateTimeFormat(pattern = POSConstant.APP_DATE_FORMAT)
    protected DateTime paymentDate;

    @Column(name = "PAYMENT_PROCESS_DATE", unique = false, nullable = true)
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
    @JsonSerialize(using = JodaDateTimeJsonSerializer.class)
    @DateTimeFormat(pattern = POSConstant.APP_DATE_FORMAT)
    protected DateTime paymentProcessDate;


    @Column(name = "PAYMENT_AMOUNT", unique = false, nullable = true)
    protected Double paymentAmount;

    @Column(name = "PAYMENT_METHOD", unique = false, nullable = true)
    @Enumerated(EnumType.STRING)
    protected PaymentMethod paymentMethod;

    @Column(name = "PAYMENT_STATUS", unique = false, nullable = true)
    @Enumerated(EnumType.STRING)
    protected PaymentStatus paymentStatus;


    @Column(name = "COMMENTS", unique = false, nullable = true)
    private String comments;

    @Column(name = "CHECK_NUMBER", unique = false, nullable = true)
    private String checkNumber;

    @Column(name = "BANK_NAME", unique = false, nullable = true)
    private String bankName; //If bank transfer which bank or checkbook belongs to which bank

    @Column(name = "ACCOUNT_NUMBER", unique = false, nullable = true)
    private String accountNumber;   //Account number from where money got credited/debited

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public String getCheckNumber() {
        return checkNumber;
    }

    public void setCheckNumber(String checkNumber) {
        this.checkNumber = checkNumber;
    }

    public Long getPaymentId() {
        return paymentId;
    }

    public void setPaymentId(Long paymentId) {
        this.paymentId = paymentId;
    }

    public DateTime getPaymentDate() {
        return paymentDate;
    }

    public void setPaymentDate(DateTime paymentDate) {
        this.paymentDate = paymentDate;
    }

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }

    public Double getPaymentAmount() {
        return paymentAmount;
    }

    public void setPaymentAmount(Double paymentAmount) {
        this.paymentAmount = paymentAmount;
    }

    public PaymentMethod getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(PaymentMethod paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    public PaymentStatus getPaymentStatus() {
        return paymentStatus;
    }

    public void setPaymentStatus(PaymentStatus paymentStatus) {
        this.paymentStatus = paymentStatus;
    }

    public DateTime getPaymentProcessDate() {
        return paymentProcessDate;
    }

    public void setPaymentProcessDate(DateTime paymentProcessDate) {
        this.paymentProcessDate = paymentProcessDate;
    }
}
